//
//  CellNewAddress.m
//  Youhuiju
//
//  Created by liuovyue on 16/8/12.
//  Copyright © 2016年 yutenys. All rights reserved.
//

#import "CellNewAddress.h"
#import "NewAddressTwoController.h"
#import "ModelAddress.h"


@interface CellNewAddress()


@property (strong, nonatomic) IBOutlet UILabel *labelName;
@property (strong, nonatomic) IBOutlet UILabel *labelNumber;
@property (strong, nonatomic) IBOutlet UILabel *labelAddress;
@property (strong, nonatomic) IBOutlet UILabel *labelPay;
@property (strong, nonatomic) IBOutlet UILabel *labelDefaultAddress;
@property (strong, nonatomic) IBOutlet UILabel *labelAddressTwo;



@end

@implementation CellNewAddress

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
    
    
    self.isSelct = NO;
    self.isSelct = self.buttonSure.selected;
    
    [self.buttonSure setImage:[UIImage imageNamed:@"1-kongxinyuan"] forState:UIControlStateNormal];
     [self.buttonSure setImage:[UIImage imageNamed:@"1-shixinyuan"] forState:UIControlStateSelected];
    self.labelName.font = [UIFont systemFontOfSize:17*FitW];
    self.labelName.textColor = [UIColor colorWithHexString:@"333333"];
    self.labelNumber.font = [UIFont systemFontOfSize:17*FitW];
    self.labelNumber.textColor = [UIColor colorWithHexString:@"333333"];
    self.labelAddress.font = [UIFont systemFontOfSize:13*FitW];
    self.labelAddress.textColor = [UIColor colorWithHexString:@"333333"];
    
    self.labelPay.font = [UIFont systemFontOfSize:11*FitW];
    self.labelPay.textColor = [UIColor colorWithHexString:@"999999"];
    
    self.labelDefaultAddress.font = [UIFont systemFontOfSize:12*FitW];
    self.labelDefaultAddress.textColor = [UIColor colorWithHexString:@"666666"];
    
    
    self.buttonEdit.titleLabel.font = [UIFont systemFontOfSize:12*FitW];
 
    self.buttonDelete.titleLabel.font = [UIFont systemFontOfSize:12*FitW];
    self.buttonEdit.tintColor = [UIColor colorWithHexString:@"666666"];
    self.buttonDelete.tintColor = [UIColor colorWithHexString:@"666666"];
    
}

- (IBAction)buttonEditAcion:(id)sender {
    NSLog(@"编辑");
    id object = [self nextResponder];
    while (![object isKindOfClass:[UIViewController class]]&& object != nil) {
        
    object =   [object nextResponder];
    }
    
    UIViewController *vc = (UIViewController *)object;
    NewAddressTwoController *newAddress = [[NewAddressTwoController alloc]init];
    newAddress.labelNew  = [[UILabel alloc]init];
    newAddress.labelTel = [[UILabel alloc]init];
    newAddress.labelQu = [[UILabel alloc]init];
    newAddress.labelDizhi = [[UILabel alloc]init];

    newAddress.labelNew.text = self.labelName.text;
    newAddress.labelQu.text = self.labelAddress.text;
    newAddress.labelTel.text = self.labelNumber.text;
    newAddress.labelDizhi.text = self.labelAddressTwo.text;
    [vc.navigationController pushViewController:newAddress animated:YES];
 
 
    
    
    
    
}

#pragma mark - 传值
- (void)passAddress:(ModelAddress *)model {
    self.labelName.text = model.name;
    self.labelNumber.text = model.phone;
    self.labelAddress.text = model.area;
    self.labelAddressTwo.text = model.address;
}



- (IBAction)buttonSureAction:(UIButton *)sender {
    
}
- (void)passButtonSlecter:(BOOL )isSlect {
   
   
 
   
   
    if (isSlect == 1) {
        self.buttonSure.selected = 1;
        
    }else {
        self.buttonSure.selected = 0;
    }
    
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
